(function($) {
	
	$.fn.isTheNewCourseModify = function(param){
		
		return $(this).each(function(){
			
			var cancelModifyBtn = $('.cancel', this),
				capacityWithVideo = $('#capacity_item .capacity_with_video'),
				courseUniqueId = $('#courseUniqueId').val(),
				detailCount = $("#detail_count"),
				detailLimitDisplay = $("#detail_tips .detail_limit"),
				detailTips = $('#detail_tips'),
				duobeiJSPath = $('#duobei_js_path').val(),
				maxAttendeesWithVideo = $('#maxAttendeesWithVideo').val(),
				maxAttendeesWithoutVideo = $('#maxAttendeesWithoutVideo').val(),
				modifyBtn = $('.item .modify', this),
				setCode = $('#set_code');
			
			
						
			// 富文本编辑器--goods出现
			var editorInited = false;
			
			$("#goods2 .cancel").click(function() {
				$('html, body').animate({scrollTop: '0px'}, 500);
				$('#goods').slideUp(500);
			});
			
			$('#edit_info_trigger5').click(function(){
				if($('#goods').css('display') === 'none') {
					$('#goods').slideDown(500);
						
					if(editorInited) {
						return;
					}
					
					$('textarea.detail_textarea').tinymce({
						// Location of TinyMCE script
						script_url : [duobeiJSPath, '/tinymce/tiny_mce.js?v=201204012327'].join(''),

						// General options
						theme : "advanced",
						plugins : "inlinepopups, paste",
						
						charLimit : 500,
						
						paste_auto_cleanup_on_paste: true,
						valid_elements: 'strong/b,em/i,b,i,u,ol,ul,li,p,br',

						// Theme options
						theme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist",
						theme_advanced_buttons2 : "",
						theme_advanced_buttons3 : "",
						theme_advanced_buttons4 : "",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "none",
						theme_advanced_resizing : true,
						plugins : 'legacyoutput',
						language : "cn",
						setup : function (ed) {
							
							ed.onKeyUp.add(function (ed, evt) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
								//validate description
								infoValidator.element($(detailCount));
							});
							ed.onLoadContent.add(function(ed, o) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
							});
							ed.onInit.add(function(ed) {
								var edDoc = ed.dom.getRoot();
								
								$(edDoc).focus(function() {
									detailTips.show();
									return false;
								}).blur(function() {
									detailTips.hide();
									infoValidator.element($(detailCount));
									return false;
								});
							});
							
						}
					});
					
					editorInited = true;
					
				} else {
					$('#goods').slideUp(500);
				}
			});
			
			
			
			
			// 富文本编辑器--money出现
			var editorInited = false;
			
			$("#money2 .cancel").click(function() {
				$('html, body').animate({scrollTop: '0px'}, 500);
				$('#money').slideUp(500);
			});
			
			$('#edit_info_trigger8').click(function(){
				if($('#money').css('display') === 'none') {
					$('#money').slideDown(500);
						
					if(editorInited) {
						return;
					}
					
					$('textarea.detail_textarea').tinymce({
						// Location of TinyMCE script
						script_url : [duobeiJSPath, '/tinymce/tiny_mce.js?v=201204012327'].join(''),

						// General options
						theme : "advanced",
						plugins : "inlinepopups, paste",
						
						charLimit : 500,
						
						paste_auto_cleanup_on_paste: true,
						valid_elements: 'strong/b,em/i,b,i,u,ol,ul,li,p,br',

						// Theme options
						theme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist",
						theme_advanced_buttons2 : "",
						theme_advanced_buttons3 : "",
						theme_advanced_buttons4 : "",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "none",
						theme_advanced_resizing : true,
						plugins : 'legacyoutput',
						language : "cn",
						setup : function (ed) {
							
							ed.onKeyUp.add(function (ed, evt) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
								//validate description
								infoValidator.element($(detailCount));
							});
							ed.onLoadContent.add(function(ed, o) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
							});
							ed.onInit.add(function(ed) {
								var edDoc = ed.dom.getRoot();
								
								$(edDoc).focus(function() {
									detailTips.show();
									return false;
								}).blur(function() {
									detailTips.hide();
									infoValidator.element($(detailCount));
									return false;
								});
							});
							
						}
					});
					
					editorInited = true;
					
				} else {
					$('#money').slideUp(500);
				}
			});
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			// 富文本编辑器2
			var editorInited = false;
			
			$("#edit_course_info22 .cancel").click(function() {
				$('html, body').animate({scrollTop: '0px'}, 500);
				$('#edit_course_info2').slideUp(500);
			});
			
			$('#edit_info_trigger2').click(function(){
				if($('#edit_course_info2').css('display') === 'none') {
					$('#edit_course_info2').slideDown(500);
						
					if(editorInited) {
						return;
					}
					
					$('textarea.detail_textarea').tinymce({
						// Location of TinyMCE script
						script_url : [duobeiJSPath, '/tinymce/tiny_mce.js?v=201204012327'].join(''),

						// General options
						theme : "advanced",
						plugins : "inlinepopups, paste",
						
						charLimit : 500,
						
						paste_auto_cleanup_on_paste: true,
						valid_elements: 'strong/b,em/i,b,i,u,ol,ul,li,p,br',

						// Theme options
						theme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist",
						theme_advanced_buttons2 : "",
						theme_advanced_buttons3 : "",
						theme_advanced_buttons4 : "",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "none",
						theme_advanced_resizing : true,
						plugins : 'legacyoutput',
						language : "cn",
						setup : function (ed) {
							
							ed.onKeyUp.add(function (ed, evt) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
								//validate description
								infoValidator.element($(detailCount));
							});
							ed.onLoadContent.add(function(ed, o) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
							});
							ed.onInit.add(function(ed) {
								var edDoc = ed.dom.getRoot();
								
								$(edDoc).focus(function() {
									detailTips.show();
									return false;
								}).blur(function() {
									detailTips.hide();
									infoValidator.element($(detailCount));
									return false;
								});
							});
							
						}
					});
					
					editorInited = true;
					
				} else {
					$('#edit_course_info2').slideUp(500);
				}
			});
			// 富文本编辑器3
							var editorInited = false;

							$("#edit_course_info3 .cancel").click(function() {
								$('html, body').animate( {
									scrollTop : '0px'
								}, 500);
								$('#edit_course_info3').slideUp(500);
							});

							$('#edit_info_trigger3')
									.click(
											function() {
//												$('#goods').css('display')=='none';
												
												if ($('#edit_course_info3')
														.css('display') === 'none') {
													$('#edit_course_info3')
															.slideDown(500);

													if (editorInited) {
														return;
													}

													$(
															'textarea.detail_textarea')
															.tinymce(
																	{
																		// Location of TinyMCE script
																		script_url : [
																				duobeiJSPath,
																				'/tinymce/tiny_mce.js?v=201204012327' ]
																				.join(''),

																		// General options
																		theme : "advanced",
																		plugins : "inlinepopups, paste",

																		charLimit : 500,

																		paste_auto_cleanup_on_paste : true,
																		valid_elements : 'strong/b,em/i,b,i,u,ol,ul,li,p,br',

																		// Theme options
																		theme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist",
																		theme_advanced_buttons2 : "",
																		theme_advanced_buttons3 : "",
																		theme_advanced_buttons4 : "",
																		theme_advanced_toolbar_location : "top",
																		theme_advanced_toolbar_align : "left",
																		theme_advanced_statusbar_location : "none",
																		theme_advanced_resizing : true,
																		plugins : 'legacyoutput',
																		language : "cn",
																		setup : function(
																				ed) {

																			ed.onKeyUp
																					.add(function(
																							ed,
																							evt) {
																						var tx = tinyMCE.activeEditor
																								.getContent()
																								.replace(
																										/\.\.\./g,
																										'');
																						tx = tx
																								.replace(
																										/<.[^<>]*?>/g,
																										'');
																						tx = tx
																								.replace(
																										/&nbsp;|&#160;/gi,
																										' ');
																						tx = tx
																								.replace(
																										/(\w+)(&.+?;)+(\w+)/,
																										"$1$3")
																								.replace(
																										/&.+?;/g,
																										'');
																						tx = tx
																								.replace(
																										/[\r\t\n]/g,
																										'');

																						var charCount = tx.length;
																						detailCount
																								.val(charCount);
																						detailLimitDisplay
																								.html((500 - charCount) < 0 ? 0
																										: (500 - charCount));
																						//validate description
																						infoValidator
																								.element($(detailCount));
																					});
																			ed.onLoadContent
																					.add(function(
																							ed,
																							o) {
																						var tx = tinyMCE.activeEditor
																								.getContent()
																								.replace(
																										/\.\.\./g,
																										'');
																						tx = tx
																								.replace(
																										/<.[^<>]*?>/g,
																										'');
																						tx = tx
																								.replace(
																										/&nbsp;|&#160;/gi,
																										' ');
																						tx = tx
																								.replace(
																										/(\w+)(&.+?;)+(\w+)/,
																										"$1$3")
																								.replace(
																										/&.+?;/g,
																										'');
																						tx = tx
																								.replace(
																										/[\r\t\n]/g,
																										'');

																						var charCount = tx.length;
																						detailCount
																								.val(charCount);
																						detailLimitDisplay
																								.html((500 - charCount) < 0 ? 0
																										: (500 - charCount));
																					});
																			ed.onInit
																					.add(function(
																							ed) {
																						var edDoc = ed.dom
																								.getRoot();

																						$(
																								edDoc)
																								.focus(
																										function() {
																											detailTips
																													.show();
																											return false;
																										})
																								.blur(
																										function() {
																											detailTips
																													.hide();
																											infoValidator
																													.element($(detailCount));
																											return false;
																										});
																					});

																		}
																	});

													editorInited = true;

												} else {
													$('#edit_course_info3')
															.slideUp(500);
												}
											});
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			

			// 富文本编辑器1
			var editorInited = false;
			
			$("#edit_course_info .cancel").click(function() {
				$('html, body').animate({scrollTop: '0px'}, 500);
				$('#edit_course_info').slideUp(500);
			});
			
			$('#edit_info_trigger').click(function(){
				if($('#edit_course_info').css('display') === 'none') {
					$('#edit_course_info').slideDown(500);
						
					if(editorInited) {
						return;
					}
					
					$('textarea.detail_textarea').tinymce({
						// Location of TinyMCE script
						script_url : [duobeiJSPath, '/tinymce/tiny_mce.js?v=201204012327'].join(''),

						// General options
						theme : "advanced",
						plugins : "inlinepopups, paste",
						
						charLimit : 500,
						
						paste_auto_cleanup_on_paste: true,
						valid_elements: 'strong/b,em/i,b,i,u,ol,ul,li,p,br',

						// Theme options
						theme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist",
						theme_advanced_buttons2 : "",
						theme_advanced_buttons3 : "",
						theme_advanced_buttons4 : "",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "none",
						theme_advanced_resizing : true,
						plugins : 'legacyoutput',
						language : "cn",
						setup : function (ed) {
							
							ed.onKeyUp.add(function (ed, evt) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
								//validate description
								infoValidator.element($(detailCount));
							});
							ed.onLoadContent.add(function(ed, o) {
								var tx = tinyMCE.activeEditor.getContent().replace(/\.\.\./g, '');
								tx = tx.replace(/<.[^<>]*?>/g, '');
								tx = tx.replace(/&nbsp;|&#160;/gi, ' ');
								tx = tx.replace(/(\w+)(&.+?;)+(\w+)/, "$1$3").replace(/&.+?;/g, '');
								tx = tx.replace(/[\r\t\n]/g, '');
								
								var charCount = tx.length;
								detailCount.val(charCount);
								detailLimitDisplay.html((500 - charCount) < 0 ? 0 : (500 - charCount));
							});
							ed.onInit.add(function(ed) {
								var edDoc = ed.dom.getRoot();
								
								$(edDoc).focus(function() {
									detailTips.show();
									return false;
								}).blur(function() {
									detailTips.hide();
									infoValidator.element($(detailCount));
									return false;
								});
							});
							
						}
					});
					
					editorInited = true;
					
				} else {
					$('#edit_course_info').slideUp(500);
				}
			});
			
			// 验证
			jQuery.validator.addMethod("alphanumeric", function(value, element) {
				return this.optional(element) || /^[A-Za-z0-9]+$/.test(value);
			}, '字母或数字');
			jQuery.validator.addMethod("integer", function(value, element) {
				return this.optional(element) || /^-?\d+$/.test(value);
			}, "A positive or negative non-decimal number please");
			
			var infoValidator = $('#edit_course_info_form').validate({
				errorElement:'span',
				errorClass:'error_tip',
				focusInvalid:false,
				submitHandler: function(form){
					
					$.ajax({
						async:false,
						url:$('#edit_course_info_form').attr('action'),
						type:'post',
						dataType:'json',
						data:$('#edit_course_info_form').serialize(),
						beforeSend: function (xhr) {
							 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
						},
						success:function(json){
							if(json.success){
								$('html, body').animate({scrollTop: '0px'}, 500);
								$('#edit_course_info').slideUp(500);
								$('#content h2, #nav_title').text($('#course_title').val());
								if(!$.browser.msie) {
									$('title').text($('#course_title').val());
								}
							}
						}
					});
					return false;
				},
				errorPlacement:function(error,element) {
					element.parents('.info_item').find('.error_wrapper').append(error).show();
				}, 
				success:function(element){
					element.parents('.info_item').find('.error_wrapper').empty().hide();
				},
				messages: {
					title: {
						required	: '请确定课程名称'
					},
					detailCount:{
						min			: '内容简介不能为空',
						max			: '内容简介不能大于500字'
					},
					courseImageInfoId:{
						required	: '请设置封面图片'
					}
				}
			});
			
			var configValidator = $('#update_course_config_form').validate({
				errorElement:'span',
				errorClass:'error_tip',
				focusInvalid:false,
				submitHandler: function(form){

					var item = $('#update_course_config_form').parents('.item'),
						itemContent = $('.item_content', item);
				
					$.ajax({
						async:false,
						url:$('#update_course_config_form').attr('action'),
						type:'post',
						dataType:'json',
						data:$('#update_course_config_form').serialize(),
						beforeSend: function (xhr) {
							 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
						},
						success:function(json){
							
							if(json.success){
								if($('#vedio_radio_on').attr('checked') === 'checked'){
									$('#video_switch').text('开启');
								} else {
									$('#video_switch').text('关闭');
								}
								
								if($('#record_radio_on').attr('checked') === 'checked'){
									$('#record_switch').text('');
								} else {
									$('#record_switch').text('无');
								}
								$('#course_capacity').text($('#capacity').val());
								
								$('.edit_wrap', item).hide();
								$('.pre_edit_wrap', item).hide();
								$(itemContent).show();
							}
						}
					});
					$('.edit_wrap', item).hide();
					$('.pre_edit_wrap', item).hide();
					$(itemContent).show();
					return false;
				},
				errorPlacement:function(error,element) {
					element.parents('.item').find('.error_wrapper').append(error).show();
				}, 
				success:function(element){
					element.parents('.item').find('.error_wrapper').empty().hide();
				},
				messages: {
					capacity:{
						required	: '请填写教室人数',
						integer		: '请填写正确教室人数',
						min			: '教室人数必须是大于0的整数',
						max			: '教室人数不能超过{0}'
					}
				}
			});
			
			var privacyValidator = $('#update_course_privacy_form').validate({
				errorElement:'span',
				errorClass:'error_tip',
				focusInvalid:false,
				submitHandler: function(form){
						
					var item = $('#update_course_privacy_form').parents('.item'),
						itemContent = $('.item_content', item);
				
					$.ajax({
						async:false,
						url:$('#update_course_privacy_form').attr('action'),
						type:'post',
						dataType:'json',
						data:$('#update_course_privacy_form').serialize(),
						beforeSend: function (xhr) {
							 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
						},
						success:function(json){
							if(json.success){
								if($('#auth_radio_on').attr('checked') === 'checked') {
									$('p.public', itemContent).hide();
									$('p.private', itemContent).show();
									$('#show_room_pwd').text($('#roomPwd').val());
								} else {
									$('p.private', itemContent).hide();
									$('p.public', itemContent).show();
								}
								$('.edit_wrap', item).hide();
								$('.pre_edit_wrap', item).hide();
								$(itemContent).show();
							}
						}
					});
					$('.edit_wrap', item).hide();
					$('.pre_edit_wrap', item).hide();
					$(itemContent).show();
					return false;
				},
				errorPlacement:function(error,element) {
					element.parents('.edit_wrap').find('.error_wrapper').append(error).show();
					element.parents('.edit_wrap').find('.pwd_tip').hide();
				}, 
				success:function(element){
					element.parents('.edit_wrap').find('.error_wrapper').empty().hide();
					$('.pwd_tip').show();
				},
				messages: {
					roomPwd:{
						required	: '请输入密码',
						minlength	: '教室密码为4位',
						maxlength	: '教室密码为4位'
					}
				}
			});
			
			$('#edit_course_info_form').submit(function(){
				
				if($('.error_wrapper .error_tip').filter(":visible").length > 0){
					$("html, body").animate({
						 scrollTop: $('.error_wrapper .error_tip').filter(":visible").eq(0).offset().top - 20 +"px"
						}, {
						duration: 500,
						easing: "swing"
					});
				}
				return false;
			});
			
			$('#update_course_time_form').bind('submit', function(){

				var item = $(this).parents('.item'),
					itemContent = $('.item_content', item);
				
				$.ajax({
					async:false,
					url:$(this).attr('action'),
					type:'post',
					dataType:'json',
					data:$(this).serialize(),
					beforeSend: function (xhr) {
						 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
					},
					success:function(json){
						if(json.success){
							$('p', itemContent).text([json.day, '，', json.dayOfWeek, '，', json.time].join(''));
							$('.edit_wrap', item).hide();
							$('.pre_edit_wrap', item).hide();
							$(itemContent).show();
						}
					}
				});
				$('.edit_wrap', item).hide();
				$('.pre_edit_wrap', item).hide();
				$(itemContent).show();
				return false;
				
			});//验证结束

			$('#roomPwd').keyup(function(){
				if($(this).valid()) {
					$('#pwd_tip').show();
				} else {
					$('#pwd_tip').hide();
				}
			}).blur(function(){
				if($(this).valid()) {
					$('#pwd_tip').show();
				} else {
					$('#pwd_tip').hide();
				}
			});
			
			$('#course_title').maxlength({
				statusElement:$('.title_limit'),
				maxlength:30
				
			}).focus(function() {
				$('#title_tips').show();
				return false;
				
			}).blur(function() {
				$('#title_tips').hide();
				infoValidator.element($(this));
				return false;
			});
			
			$('#del_course').click(function(){
				if(confirm('确认删除？')){
					$.ajax({
						url: [$.global.getContextPath(), '/manage-course/', courseUniqueId, '/delete'].join(''),
						type: 'post',
						dataType: 'json',
						success: function(json){
							document.location.href = [$.global.getContextPath(), '/dashboard/manage-course'].join('');
						}
					});
				}
			});
			
			$(modifyBtn).click(function(){

				var item = $(this).parents('.item');
				$('.item_content', item).hide();
				$('.pre_edit_wrap', item).show();
				$('.edit_wrap', item).slideDown();
			});
			
			$(cancelModifyBtn).click(function(){
				
				var item = $(this).parents('.item');
				$('.edit_wrap', item).hide();
				$('.pre_edit_wrap', item).hide();
				$('.item_content', item).show();
			});
			
			$('#start_time').datepicker({
		    	
				duration		: '',
		        showTime		: true,
		        constrainInput	: false,
				time24h			: true,
				dateFormat		: 'yy-mm-dd',
				closeText		: '确定',
				hideIfNoPrevNext: true,
				maxDate			: '+1y',
				minDate			: '-0d'
		    });
			
			$('#choose_date').click(function() {
				
				$('#start_time').focus();
			});
			
			
			$('input[type="radio"]', $('#auth_item')).change(function(){

				if($(this).val() === ("" + true)) {

					$('input[type="text"]', $(setCode)).removeAttr("disabled");
					$(setCode).fadeIn();
				} else {
					
					$(setCode).fadeOut(300, function() {
						$('input[type="text"]', $(setCode)).attr("disabled", "disabled");
					});

					if($('input[type="text"]', $(setCode)).valid() || $('input[type="text"]', $(setCode)).val() === ''){
						
						$('.error_wrapper', $('#auth_item')).empty().hide();
						$('#pwd_tip').show();
					}
				}
			});
			
			$('input[type="radio"]', $('#video_item')).change(function(){
				
				if($(this).val() == "" + true){
					
					$('#capacity').attr('max', maxAttendeesWithVideo);
					$(capacityWithVideo).animate({
						marginTop: '0em'
					});
				} else{
					
					$('#capacity').attr('max', maxAttendeesWithoutVideo);
					$(capacityWithVideo).animate({
						marginTop: '-2em'
					});
				}
				configValidator.element($(capacity));
			});
			
			$('a', $('#page_scroll')).live('click', function() {
				var that = $(this);
				
				if(that.hasClass('disabled')) {
					return false;
				} else {
					$.ajax({
						async:false,
						url:that.attr('href'),
						type:'get',
						dataType:'html',
						beforeSend: function (xhr) {
							 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
						},
						success:function(html){
							$(that).parents('.attend_user_list').replaceWith(html);
						}
					});
					return false;
				}
			});
			
			$('#upload_img')
			.attr('href', [$.global.getContextPath(), '/course/img/all'].join(''))
			.wokaobox({
				'width'	: 700,
				'height': 480,
				'type'	: 'iframe'
			});
			
			$('#upload_document')
			.attr('href', [$.global.getContextPath(), '/documents/pop/', courseUniqueId].join(''))
			.wokaobox({
				'width'	: 700,
				'height': 502,
				'type'	: 'iframe'
			});
			
			$('#course_share_weibo').wokaobox({
				'width'			: 512,
				'height'		: 270,
				'type'			: 'iframe',
				'closeMethod'	: 'changeOut',
				'closeBtn'		: false,
				'afterClose'	: function(){
					if($('#course_share_weibo_bind').attr('href') != 'javascript:;'){
						
						$.wokaobox.open({
							'href'			: $('#course_share_weibo_bind').attr('href'),
							'width'			: 570,
							'height'		: 349,
							'type'			: 'iframe',
							'openMethod'	: 'changeIn',
							'closeMethod'	: 'changeOut',
							'closeBtn'		: false,
							'afterClose'	: function(){
								$('#course_share_weibo_bind').attr('href', 'javascript:;');
							}
						});
					}
				}
			});
		});
	};
})(jQuery);